package cn.itsource.basic.util;

import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;

/**
 * 功能效果:没交作业的直接获取名字
 * <p>
 * 作业要求
 * 1.上交必须是文件夹
 * 1.1命名规范  月日+名字 如当天8月25日  文件夹命名:825王坡
 * 2.文件夹内容
 * 2.1总结
 * 2.2代码zip
 * 2.3今日功能截图(截图要能证明今天功能已完成)
 */
public class HomeWorkTest {


    //要遍历的路径
    private static final String FILE_PATH = "F:\\Java2022_10_10\\作业\\2月";

    private static final boolean flag1 = true;
    private static final String DATE_STR = "0206";

    private static final boolean flag2 = true;
    private static final String DATE_STR2 = "0207";

    private static final boolean flag3 = true;
    private static final String DATE_STR3 = "0208";

    public static void main(String[] args) {

/*        List<Long> longs = Arrays.asList(1L, 2L, 3L);
        System.out.println(longs.getClass());

        ArrayList<Long> longs1 = new ArrayList<>(longs);
        System.out.println(longs1.getClass());

        longs.add(4L);
        System.out.println(longs);*/

        //调用方法
        ArrayList<String> allList = getStrings();
        //得到数据
        allList.forEach(System.out::println);
    }

    private static ArrayList<String> getStrings() {


        List<String> all = Arrays.asList(
                "蔡熊",
                "吴裕祺",
                "伍茂盛",
                "李乘龙",
                "王康",
                "邹雄",
                "钱天胜",
                "鲁俊杰",
                "蒋帅",
                "游鸿星",
                "高雨娟",
                "周院梦钊",
                "贺运涛",
                "程志鹏",
                "陈雄",
                "张业锋",
                "范志熠",
                "高雨欣",
                "朱恺燚",
                "徐小龙",
                "朱柱胜",
                "张明卓",
                "占祺",
                "柯凯",
                "卫松",
                "褚旭",
                "何梓丰",
                "刘可",
                "张灿帮",
                "廖奋",
                "肖子健",
                "尹博",
                "肖永晨",
                "刘佳杰",
                "杨志峰",
                "黄永恒",
                "李胡焕",
                "程文博",
                "杨泽鑫",
                "袁野",
                "陈绪兵",
                "杨志新",
                "李嘉俊",
                "杨梓星");

        ArrayList<String> allList = new ArrayList<>(all);
        ArrayList<String> list = new ArrayList<>();

        File file = new File(FILE_PATH); //获取其file对象
        File[] fs = file.listFiles();    //遍历path下的文件和目录，放在File数组中
        if (fs != null)
            for (File f : fs) {    //遍历File[]数组
                if (f.isDirectory()) {
                    if (flag1 && f.getName().contains(DATE_STR)) {
                        list.add(f.getName().replace(DATE_STR, ""));
                    }
                    if (flag2 && f.getName().contains(DATE_STR2)) {
                        list.add(f.getName().replace(DATE_STR2, ""));
                    }
                    if (flag3 && f.getName().contains(DATE_STR3)) {
                        list.add(f.getName().replace(DATE_STR3, ""));
                    }
                }
            }
        //剔除已有的
        allList.removeAll(list);
        return allList;
    }




}



